import { defineConfig } from 'wxt';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';

// See https://wxt.dev/api/config.html
export default defineConfig({
  extensionApi: 'chrome',
  manifest: () => {
    return {
      permissions: ['storage'],
      web_accessible_resources: [
        {
          resources: ["images/bizhi/*.png", "*.png"],  // 匹配public下需要在vue组件中请求的文件
          matches: ["*://www.cangquyun.com/*"]         // 允许https://www.cangquyun.com/nav域名访问
        }
      ]
    }
  },
  modules: ['@wxt-dev/module-vue'],
  vite: () => {
    return {
      plugins: [
        Components({
          dirs: ['components', 'entrypoints'],
          resolvers: [
            ElementPlusResolver({
              importStyle: true
            })
          ]
        })
      ]
    }
  }
});
